refactor(NODE-7445): replace whatwg-url with native URL/URLSearchParams#115
Open
bjnewman wants to merge 1 commit intomongodb-js:mainfrom
Open
refactor(NODE-7445): replace whatwg-url with native URL/URLSearchParams#115bjnewman wants to merge 1 commit intomongodb-js:mainfrom
bjnewman wants to merge 1 commit intomongodb-js:mainfrom
Conversation
Since v7.0 requires Node.js >= 20.19.0, the native URL class (backed by Ada) provides identical WHATWG-compliant parsing. This removes the whatwg-url, tr46, webidl-conversions, and @types/whatwg-url dependencies.
|
@bjnewman this is awesome as it would likely address the |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes
whatwg-urland@types/whatwg-urlas runtime dependencies. Since v7.0.0 requires Node >= 20.19.0, the nativeURLimplementation (Ada-backed since Node 18) is already WHATWG-compliant, making the polyfill unnecessary.There's no open issue for this — I expect this is something you're already aware of and just haven't gotten around to. Happy to adjust anything.
What changed
whatwg-urland@types/whatwg-urlfrom dependenciesimport { URL, URLSearchParams } from 'whatwg-url'importURLWithoutHostabstract class with a re-typedURLBaseconstant usingOmit<>to handle the TS2611 property-vs-accessor conflict with native URL's type declarationsAll 61 existing tests pass without modification. Also verified with the
mongodbdriver in a test project — parsing, redaction, cloning, and case-insensitive params all work as expected.